import request from '@/utils/request'
// 查询采购订单列表
export function listSaleorder(query) {
  return request({
    url: '/order/saleorder/list',
    method: 'get',
    params: query
  })
}
//采购订单弹窗列表
export  function outInListsaleOrder(query){
  return request({
    url: '/order/saleorder/poplist',
    method: 'get',
    params: query
  })
}
// 查询采购订单详细
export function getsaleorder(id) {
  return request({
    url: '/order/saleorder/' + id,
    method: 'get'
  })
}

// 新增采购订单
export function addsaleorder(data) {
  return request({
    url: '/order/saleorder',
    method: 'post',
    data: data
  })
}

// 修改采购订单
export function updatesaleorder(data) {
  return request({
    url: '/order/saleorder',
    method: 'put',
    data: data
  })
}
// 删除采购订单
export function delsaleorder(id) {
  return request({
    url: '/order/saleorder/' + id,
    method: 'delete'
  })
}
//判断一个对象的属性存在于数组中
export  function isObjectInArray(array,obj,property){

  for (let i = 0; i < array.length; i++) {
    if (array[i][property]===obj[property]){
      return true;
    }

  }

  return false;
}
